#!/home/hadoop/python26/bin/python
import json
import sys
import mylib

user_pool = set()
graph_file = open('graph','r')
for lines in graph_file:
    s = lines.strip()
    r = json.loads(s)
    for id in r['target_ids']:
        user_pool.add(str(id))
graph_file.close()

for line in sys.stdin:
    r = None
    try:
        r = json.loads(line.strip())
    except:
        continue
    if r != None:
        key = str(r['id'])
        user_id = str(r['user']['id'])
        if user_id in user_pool:
            date = r['created_at']
            unix_date = mylib.Twitter.ConvertToUnix(str(date))
            r['date'] = unix_date
            value = json.dumps(r, sort_keys = False)
            print key + '\t' + value
